# graphics
USE_SPRD_HWCOMPOSER  ?= true
USE_OPENGL_RENDERER ?= true
USE_OVERLAY_COMPOSER_GPU ?= true
NUM_FRAMEBUFFER_SURFACE_BUFFERS ?= 3
SPRD_VIRTUAL_DISPLAY ?= 1
TARGET_USES_HWC2 ?= true
SPRD_TARGET_USES_HWC2 ?= true
ARCH_ARM_HAVE_TLS_REGISTER := true
MALI_PLATFORM_NAME ?= $(CHIP_NAME)

$(call md-add, $(call md-path-cur)/feature/main.mk)

PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
    ro.surface_flinger.vsync_event_phase_offset_ns=1000000 \
    ro.surface_flinger.vsync_sf_event_phase_offset_ns=1000000 \
    ro.surface_flinger.use_context_priority=true \
    ro.surface_flinger.has_wide_color_display=false \
    ro.surface_flinger.has_HDR_display=false \
    ro.surface_flinger.present_time_offset_from_vsync_ns=0 \
    ro.surface_flinger.force_hwc_copy_for_virtual_displays=false \
    ro.surface_flinger.max_virtual_display_dimension=0 \
    ro.surface_flinger.running_without_sync_framework=false \
    ro.surface_flinger.use_vr_flinger=false \
    ro.surface_flinger.max_frame_buffer_acquired_buffers=3 \
    ro.surface_flinger.start_graphics_allocator_service=false \
    ro.surface_flinger.primary_display_orientation=ORIENTATION_270

# Memtack HAL
PRODUCT_PACKAGES += \
    android.hardware.memtrack@1.0-service \
    android.hardware.memtrack@1.0-impl \
    memtrack.$(TARGET_BOARD_PLATFORM)

# RenderScript HAL
PRODUCT_PACKAGES += \
     android.hardware.renderscript@1.0-impl

# graphics modules
$(warning TARGET_GPU_PLATFORM = $(TARGET_GPU_PLATFORM))

ifeq ($(strip $(USE_SPRD_HWCOMPOSER)),true)
$(warning, if sprd hwcomposer is not ready, USE_SPRD_HWCOMPOSER should not be true)
PRODUCT_PACKAGES +=  hwcomposer.$(TARGET_BOARD_PLATFORM)
endif

PRODUCT_COPY_FILES += \
    frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml

GPU_GRALLOC_INCLUDES := $(TOP)/vendor/sprd/external/drivers/gpu/$(TARGET_GPU_PLATFORM)/include
PRODUCT_PACKAGES += \
    gralloc.$(TARGET_BOARD_PLATFORM)
